package cn.wolfcode.luowowo.article.domain;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class Attractions implements Serializable {
    private Long id;

    private Long parent_id;

    private Long dest_id;

    private Long CharacteristicId;

    private String title;

    private String subtitle;

    private String summary;

    private Integer reviewNum;

    private Integer author_id;

    private String imgsUrl;

    private List<Attractions> list;

    @DateTimeFormat(pattern = "yyyy-MM-dd:HH:mm")
    private Date updateTime;


    public String getUrl1() {
        String[] split = imgsUrl.split(",");
        String s = split[0];
        return s;
    }

    public String getUrl2() {
        String[] split = imgsUrl.split(",");
        String s = split[1];
        return s;
    }

    public String getUrl3() {
        String[] split = imgsUrl.split(",");
        String s = split[2];
        return s;
    }

    public Map getHot() {
        Map<String, Attractions> map = new HashMap<>();
        int i = 1;
        for (Attractions hot : list) {
            map.put("hot" + i, hot);
            i++;
        }
        return map;
    }

}